package com.joy.pricture.ui;

import javax.swing.*;
import java.awt.*;

/**
 * 图片预览类
 */
public class PicturePreview extends JPanel {
    //重写绘制组件，显示图片
    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        //指定图片的路径
        String filename = "D:\\program\\java\\code\\PTGame\\PTGame\\src\\main\\resources\\com\\joy\\picture\\"+PictureCanvas.pictureId+".jpg";
        //通过图片的路径，获取到对应的图片中的图像
        ImageIcon icon = new ImageIcon(filename);
        Image image = icon.getImage();
        //把凸显国会制在预览区的面板中
        g.drawImage(image,20,20,450,600,this);
    }
}
